package com.skeeey.aim.service.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.skeeey.aim.model.User;
import com.skeeey.aim.model.UserRole;
import com.skeeey.aim.service.dao.UserRoleDao;

public class UserRoleDaoImpl extends TempleteDaoImpl<UserRole, String> implements UserRoleDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<UserRole> findUserRoleListBy(User user) {
		DetachedCriteria criteria = DetachedCriteria.forClass(UserRole.class);
		criteria.add(Restrictions.eq("user", user));
		return this.getHibernateTemplate().findByCriteria(criteria);
	}

}
